package main

import (
	"fmt"
	"math"
)

var (
	aa=3
	ss="kkk"
	bb=true
)

//函数内定义变量
func variableZeroValue()  {
	var a  int
	var s  string
	fmt.Printf("%d %q\n",a,s)
}

func variableInitialValue()  {
	var a,b int  =3,4
	var s string  ="abc"
	fmt.Println(a,b,s)
}

func variableTypeDeduction()  {
	var a,b,c,s  =3,4,true,"def"
	fmt.Println(a,b,c,s)
}

func variableShorter() {
	a,b,c,s :=3,4,true,"def"
	b=5
	fmt.Println(a,b,c,s)
}

func consts()  {
	const filename  = "abc.txt"
	const a,b  =3,4
	var c int
	c=int(math.Sqrt(a*a+b*b))
	fmt.Println(filename,c)
}

//枚举
func enums()  {
	const  (

		cpp=iota
		java
		python
		golang

	)

	const(
		b=1<<(10*iota)
		kb
		mb
		gb
		tb
		pb
		)

	fmt.Println(cpp,java,python,golang)
	fmt.Println(b, kb, mb, gb, tb, pb)
}

func main() {
	fmt.Println("Hello world")
	variableZeroValue()
	variableInitialValue()
	variableTypeDeduction()
	variableShorter()
	fmt.Println(aa,ss,bb)

	//常量
	consts()
	enums()
}
